<?php
/**
 * Created by PhpStorm.
 * User: Mertred
 * Date: 2018/11/16
 * Time: 15:20
 */

namespace app\home\model;


use think\Model;

class Base extends Model
{


    /*
     * @param   更新or自增 检测字段
     * @param   数据
     * @return  结果
     * */
    public function allowSave($field,$data){
        if(empty($this->where($field,$data[$field])->find())){
            $this->allowField(true)->create($data);
            return '小程序授权成功';
        }else{
            $this->where($field,$data[$field])->update($data);
            return '小程序权限修改成功';
        }
    }
}